using EnvDTE;
using Microsoft.Practices.RecipeFramework;

namespace PrismFactory.SoftwareFactory.Extensions.ValueProviders.VisualStudio
{
    public class TargetItemsCollectionProvider : ValueProvider
    {
        public override bool OnBeginRecipe(object currentValue, out object newValue)
        {
            var vs = GetService<DTE>();
            var item = vs.SelectedItems.Item(1).ProjectItem;
            if (item != null)
                newValue = item.ProjectItems;
            else
                newValue = vs.SelectedItems.Item(1).Project.ProjectItems;
            return true;
        }
    }
}